package com.szrt.day20170506;

import java.net.InetAddress;

public class Inet4AddressTest {
	
	
	public static void main(String[] args) throws Exception{
		
		
		InetAddress localHost = InetAddress.getLocalHost();
		
		System.out.println(localHost);
		
		
		
		//InetAddress baidu = InetAddress.getByName("www.baidu.com");
		
		//System.out.println(baidu);
		
		InetAddress host=InetAddress.getByName("www.baidu.com");
		System.err.println(host.getHostAddress());

		
		
		//根据主机名得到主机名对应的ip地址s
		InetAddress[] baidus =InetAddress.getAllByName("www.baidu.com");
		for(InetAddress  baidu:baidus){
			System.out.println(baidu);
		}
	}

}
